<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    	<title>统战成员学习平台</title>
	    <link rel="stylesheet" type="text/css" href="../css/base.css" />
	    <link rel="stylesheet" type="text/css" href="../css/style.css" />
	</head>
	<body>
		<div id='app' style="display:none" v-show="true" class="main_bg">
			<header>
				<div>
					<span tapmode onclick="api.closeWin()" class="left"><i class="icon_back_white"></i></span>
					<p>忘记密码</p>
				</div>
			</header>
			<div class="login_container" :class="{'hidden': hidden}">
				<div class="logo_c">
					<img class="logo" :class="{'hidden': hidden}" src="../image/logo.png">
					<p>统战成员学习平台</p>
				</div>
				<div class="login_form">
                    <div class="item ui_border_b">
                        <img src="../image/username.png">
						<input @focus="hidden = true" @blur="hidden = false" v-model="usrAccount" type="text" placeholder="账号">
                    </div>
                    <div class="item">
                        <img src="../image/password.png">
						<input @focus="hidden = true" @blur="hidden = false" v-model="usrEmail" type="text" placeholder="邮箱">
                    </div>
                </div>
				<p class="warn"><i class="icon_warn"></i>我们将向您账号关联的邮箱发送一封重置密码的邮件，请注意查收。</p>
				<div tapmode="tap" @click="sendEmail()" class="login_btn">发送邮件</div>
				<p class="agreement">
					已有账号？<span class="a" tapmode onclick="api.closeWin()">点击登录&gt;&gt;</span>
				</p>
			</div>
		</div>
		<script type="text/javascript" src="../script/api.js"></script>
		<script type="text/javascript" src="../script/vue.min.js"></script>
		<script type="text/javascript" src="../script/common.js"></script>
		<script type="text/javascript" src="../script/layer_mobile/layer.js"></script>
		<script type="text/javascript">
		    new Vue({
		     	el: '#app',
		     	data: {
					height: 500,
					hidden: false,
		            usrAccount: '',
		            usrEmail: ''
		     	},
		     	mounted: function() {
		        	var $this = this;
		        	apiready = function() {
						var header = $api.dom('header');
						$api.fixStatusBar(header);
						$this.height = api.frameHeight - $api.offset(header).h - 15;
                	}
		    	},
		    	methods: {
					openWin: function(winName) {
						openWin(winName)
					},
					sendEmail: function() {
						var $this = this;
						if(!$this.usrAccount.length) return msgUtil.toast({msg: '请输入账号'});
						if(!$this.usrEmail.length) return msgUtil.toast({msg: '请输入邮箱'});
						if(!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test($this.usrEmail)) return msgUtil.toast({msg: '邮箱格式错误'});
						api.showProgress({
						    title: '',
						    text: '发送中...'
						});
						post('/client/user/resetPwd', {
							usrEmail: $this.usrEmail,
							usrAccount: $this.usrAccount
						}, function(ret) {
							msgUtil.toast({
							    msg: ret.message
							});
						})
					}
		    	}
		    });
		</script>
	</body>
</html>
